package com.caojm.mptools.client;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class PermissionManager {

    // 存储玩家的权限信息
    private Map<String, Set<String>> playerPermissions;

    public PermissionManager() {
        this.playerPermissions = new HashMap<>();
    }

    // 为玩家授予权限
    public void grantPermission(String playerName, String permission) {
        Set<String> permissions = playerPermissions.getOrDefault(playerName, new HashSet<>());
        permissions.add(permission);
        playerPermissions.put(playerName, permissions);
    }

    // 检查玩家是否有权限
    public boolean hasPermission(String playerName, String permission) {
        Set<String> permissions = playerPermissions.get(playerName);
        return permissions != null && permissions.contains(permission);
    }
}
